let t, b, l, r;
const TOP = 'top',
	BOTTOM = 'bottom',
	LEFT = 'left',
	RIGHT = 'right';

//上下，左右
const TB = TOP + BOTTOM,
	LR = LEFT + RIGHT;

//上右，上左，上左右
const TR = TOP + RIGHT,
	TL = TOP + LEFT,
	TLR = TL + RIGHT;

//下右，下左，下左右
const BR = BOTTOM + RIGHT,
	BL = BOTTOM + LEFT,
	BLR = BOTTOM + LR;

//上下右，上下左，上下左右
const TBR = TB + RIGHT,
	TBL = TB + LEFT,
	TBLR = TB + LR;
export const TypeAnchor = {
	TOP,
	BOTTOM,
	LEFT,
	RIGHT,
	TB,
	LR,

	TR,
	TL,
	TLR,

	BR,
	BL,
	BLR,

	TBR,
	TBL,
	TBLR
}
export const Anchor = {
	t: true,
	b: false,
	l: false,
	r: false
}

export function hGetAnchorType(anchor) {
	let d = anchor;
	if (!d) {
		return;
	}
	let ah = ''
	let l = d.l,
		r = d.r,
		t = d.t,
		b = d.b;
	if (t) {
		ah = TypeAnchor.TOP;
		if (b) {
			ah = TypeAnchor.TB;
			if (l) {
				ah = TypeAnchor.TBL;
				if (r) {
					ah = TypeAnchor.TBLR;
				}
			} else if (r) {
				ah = TypeAnchor.TBR;
			}
		} else if (r) {
			ah = TypeAnchor.TR;
			if (l) {
				ah = TypeAnchor.TLR;
			}
		} else if (l) {
			ah = TypeAnchor.TL;
		}
	} else if (b) {
		ah = TypeAnchor.BOTTOM;
		if (l) {
			ah = TypeAnchor.BL;
			if (r) {
				ah = TypeAnchor.BLR;
			}
		} else if (r) {
			ah = TypeAnchor.BR;
		}
	} else if (l) {
		ah = TypeAnchor.LEFT;
		if (r) {
			ah = TypeAnchor.LR;
		}
	}
	return ah;

}
